@extends('Admin.Layout.main')
@section('privateheader')
    <!-- DataTables -->
    <link rel="stylesheet" href="{{__BASE__}}/admin/plugins/datatables/dataTables.bootstrap.css">
@endsection
@section('content')
    <!-- Main content -->
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <div class="box-header">
                        @if($data['flag'] == 3)
                            <h3 class="box-title" style="float: left;"> 列表
                                <a class="btn bg-red" href="/admini/member/rb">回收站</a>
                                {{--<a class="btn bg-blue" href="/admini/member/buy_list/1">消费列表</a>--}}
                                {{--<a class="btn bg-blue" href="/admini/member/recharge_list/1">充值列表</a>--}}
                            </h3>
                        @elseif($data['flag'] == 4)
                            <h3 class="box-title" style="float: left;">列表回收站
                                <a class="btn bg-olive" href="{{__BASE__}}/admini/member">列表</a>
                            </h3>
                        @endif
                    </div>
                    <div class="box-header">
                        <form class="navbar-form navbar-left" role="search">
                            <div class="form-group">
                                会员角色&nbsp;
                                <select name="user_role" class="form-control">
                                    <option value="0" @if(empty($data['search']['user_role']) || $data['search']['user_role']==0) selected="selected" @endif>全部</option>
                                    <option value="1" @if(!empty($data['search']['user_role']) && $data['search']['user_role']==1) selected="selected" @endif>普通用户</option>
                                    <option value="2" @if(!empty($data['search']['user_role']) && $data['search']['user_role']==2) selected="selected" @endif>代理</option>
                                </select>
                                &nbsp;手机号码
                                <input type="text" name="phone" placeholder="请输入手机号码" class="form-control" value="{{@$data['search']['phone']}}">
                            </div>
                            <button type="submit" class="btn btn-default">搜 索</button>
                        </form>
                    </div>
                    <!-- /.box-header -->
                    <div class="box-body">
                        <table class="table table-bordered table-striped">
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>用户名</th>
                                <th>代理点数</th>
                                <th>性别</th>
                                <th>生日</th>
                                <th>手机号码</th>
                                <th>邮箱</th>
                                <th>推荐人</th>
                                <th>open_id</th>
                                <th>微信头像</th>
                                <th>用户地址</th>
                                <th>用户角色</th>
                                <th>用户状态</th>
                                <th>指纹系统用户ID</th>
                                <th>指纹系统用户名</th>
                                <th>指纹系统密码</th>
                                <th>注册时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            @if(!empty($data['list']))
                                @foreach($data['list'] as $k => $v)
                                    <tr>
                                        <td>{{$v->id or ''}}</td>
                                        <td>{{$v->name or ''}}</td>
                                        <td></td>
                                        <td>
                                            <?php
                                                if($v->sex == 1){
                                                    echo '男';
                                                }else if($v->sex == 2){
                                                    echo '女';
                                                }
                                            ?>
                                        </td>
                                        <td>{{$v->birthday or ''}}</td>
                                        <td>{{$v->phone or ''}}</td>
                                        <td>{{$v->email or ''}}</td>
                                        <td>{{$v->pid or ''}}</td>
                                        <td>{{$v->open_id or ''}}</td>
                                        <td><img width="100px" height="100px" src="{{$v->wx_avatar}}" /> </td>
                                        <td>{{$v->province_id or ''}}</td>
                                        <td>
                                            <?php
                                            if($v->user_role == 1){
                                                echo '普通用户';
                                            }else if($v->user_role == 2){
                                                echo '准代理';
                                            }else if($v->user_role == 3){
                                                echo '个代理';
                                            }else if($v->user_role == 4){
                                                echo '省代理';
                                            }else if($v->user_role == 5){
                                                echo '市代理';
                                            }else if($v->user_role == 6){
                                                echo '区代理';
                                            }
                                            ?>
                                        </td>
                                        <td>
                                            <?php
                                            if($v->status == 1){
                                                echo '正常';
                                            }else if($v->status == 2){
                                                echo '禁用';
                                            }else if($v->status == 3){
                                                echo '删除';
                                            }
                                            ?>
                                        </td>
                                        <td>{{$v->rob_uid or ''}}</td>
                                        <td>{{$v->rob_name or ''}}</td>
                                        <td>{{$v->rob_pass or ''}}</td>
                                        <td>
                                            <?php
                                                echo !empty($v->create_time) ? date('Y-m-d H:i:s',$v->create_time) : '';
                                            ?>
                                        </td>
                                        <td>
                                        @if($data['flag']==3)
                                            <a href="/admini/member/{{$v->id or ''}}/edit" class="btn bg-green">设置代理</a>
                                            <button class="btn bg-red delbutton" type="button" delurl="/admini/member/{{$v->id or ''}}" skipurl="/admini/member" ac="2" alt_attr="删除">删除</button>
                                        @elseif($data['flag'] == 4)
                                            <button class="btn bg-orange delbutton" type="button" delurl="/admini/member/{{$v->id or ''}}" skipurl="/admini/member" ac="1" alt_attr="还原">还原</button>
                                        @endif
                                        </td>
                                    </tr>
                                @endforeach
                            @endif
                            </tbody>
                        </table>
                        @if($data['list'])
                            {!! $data['list']->render() !!}
                        @endif
                    </div>
                    <!-- /.box-body -->
                </div>
                <!-- /.box -->
            </div>
            <!-- /.col -->
        </div>
        <!-- /.row -->
    </section>
@endsection
@section('privatefooter')
    <!-- DataTables -->
    <script src="{{__BASE__}}/admin/plugins/datatables/jquery.dataTables.min.js"></script>
    <script src="{{__BASE__}}/admin/plugins/datatables/dataTables.bootstrap.min.js"></script>
    <!-- page script -->
@endsection